import App from './App';
import store from './store';
import util from './utils/util.js';
import api from './api';
import mixin from './mixins/mixins.js';

// #ifndef VUE3
	
	import Vue from 'vue';
	import Vuex from "vuex";
	
	Vue.prototype.util = util;
	Vue.prototype.request = util.request;
	Vue.prototype.alert = util.alert;
	Vue.prototype.$api = api;
	Vue.config.productionTip = false;
	Vue.config.$store = store;

	// vuex
	Vue.use(Vuex);
	Vue.mixin(mixin);

	App.mpType = 'app'
	const app = new Vue({
		...App,
		store
	})
	app.$mount();

// #endif


// #ifdef VUE3

import { createSSRApp } from 'vue';

	export function createApp() {

		// 创建app
		const app = createSSRApp(App);

		// 挂载vuex
		app.use(store).mixin(mixin);

		// 全局挂载方法
		app.config.globalProperties.$util = util;

		// 全局挂载api
		app.config.globalProperties.$api = api;

		// 返回app
		return {
			app
		}
	}

// #endif